home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d12
/
ptv1n2.arc
/
XLAT.ASM
< prev
Wrap
Assembly Source File
|
1990-06-14
|
914b
|
21 lines
; Input: DS:BX = pointer to 256-byte character table, with
; characters to be filtered designated by 0 and
; other characters designated by themselves.
; CX = # of characters in input buffer.
; DS:SI = pointer to source buffer to filter from.
; ES:DI = pointer to destination buffer to filter to.
; The direction flag (DF) must be set to 0 (CLD).
; Output: DX = # of characters stored in output buffer.
FILTER:
SUB DX,DX ;zero characters transferred counter
FILTER_LOOP:
LODSB ;get next character from source buffer
XLAT ;look it up in filter table
AND AL,AL ;is it wanted?
JZ FILTER_NEXT ;if not, go to next character
STOSB ;it's wanted, store it in output buffer
INC DX ;count this character as usable
FILTER_NEXT:
LOOP FILTER_LOOP
RET